// pages/kind/kind.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
     current: 0,
     load: true,
     kind: ['剧情','喜剧','动作','爱情','科幻','悬疑','惊悚','恐怖','同性','音乐'],
     list: []
  },
  navtap: function(e){
    this.setData({
      load: true,
      current: e.currentTarget.dataset.current
    });
    this.loadData(e.currentTarget.dataset.text);
  },
  //跳转详情页
  tap:(e) =>{
    wx.navigateTo({
      url: '/pages/detail/detail?id=' + e.currentTarget.dataset.id
    })
  },
  //加载类型数据
  loadData: function(tag){
    wx.request({
      url: 'https://movie.douban.com/j/new_search_subjects?sort=T&range=0,10&tags=&start=0&genres='+ tag,
      header: {'content-type':'json'},
      success: (res)=>{
          console.log(res.data.data);
          this.setData({
              list: res.data.data,
              load: false
          });
          console.log(this.data.list)
      }
   });
  },
  onLoad: function () {
      this.loadData('剧情');
  }
})

